package com.youdianda.controller;

import com.youdianda.dto.LoginDTO;
import com.youdianda.result.Result;
import com.youdianda.service.SysIndexFgxService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "基础模块")
@RequestMapping("/index")
@RestController
public class SysIndexFgxController {

    @Autowired
    private SysIndexFgxService indexService;

    /**
     * GET 获取系统配置
     * @return
     */
    @ApiOperation("GET 获取系统配置")
    @GetMapping("/getConfig")
    public Result getConfig(){
        Result result = indexService.getConfig();
        return result;
    }

    /**
     * GET 主页统计信息
     * @return
     */
    @ApiOperation("GET 主页统计信息")
    @GetMapping("/baseInfo")
    public Result baseInfo(){
        Result result = indexService.baseInfo();
        return result;
    }

    /**
     * POST 登录接口
     * @return
     */
    @ApiOperation("POST 登录接口")
    @PostMapping("/login")
    public Result login(@RequestBody LoginDTO dto){
        Result result = indexService.login(dto);
        return result;
    }

    /**
     * POST 获取用户资料
     * @return
     */
    @ApiOperation("POST 获取用户资料")
    @PostMapping("/profile")
    public Result profile(){
        Result result = indexService.profile();
        return result;
    }


}
